/**
 * Created by LeungZ on 2016/9/6.
 */
import './welcome.scss';
import temp from './welcome.html';
import ctrl from './welcome.ctrl.js';

export default angular.module('ctg-k8sconsole').config(['$stateProvider', $stateProvider=> {
    $stateProvider.state('welcome', {
        url: '/welcome',
        templateUrl: temp,
        controller: ctrl,
        controllerAs: 'wlc',
        resolve: {
            k8sList: ['clusterSrv', 'ctgNotification', function (clusterSrv, ctgNotification) {
                return clusterSrv.getClusterList().catch(function (data) {
                    ctgNotification.error('获取容器集群列表数据有误.');
                });
            }],
            dckList: ['imageSrv', 'ctgNotification','$rootScope', function (imageSrv, ctgNotification,$rootScope) {
                return imageSrv.getHarborImages({sysUserCode:JSON.parse(localStorage.getItem('myUser')).sysUserCode,currentPage: 1,imageType:$rootScope.imageType?$rootScope.imageType:'002'}).catch(function (data) {
                    ctgNotification.error('获取Docker镜像列表数据有误.');
                });
            }],
            sapList: ['appSrv', 'ctgNotification', function (appSrv, ctgNotification) {
                return appSrv.getAppList({currentPage: 1}).catch(function (data) {
                    ctgNotification.error('获取应用列表数据有误.');
                });
            }]
        }
    })
}]);